package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppTeaFriendDao;
import com.vf.admin.client.service.AppTeaFriendService;
import com.vf.admin.client.service.AppUserService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppTeaFriend;
import com.vf.admin.miaodong.entity.AppTripFriend;
import com.vf.admin.miaodong.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>Title : </p>
 * <p>Description : </p>
 * <p>DevelopTools : IDEA</p>
 * <p>DevelopSystem : Windows11</p>
 *
 * @Author : zxw
 * @Date 2023/9/4 17:44
 */
@Service
public class AppTeaFriendServiceImpl implements AppTeaFriendService {
    @Autowired
    private AppTeaFriendDao appTeaFriendDao;
    @Autowired
    private AppUserService appUserService;

    @Override
    public void save(AppTeaFriend param) {
        appTeaFriendDao.save(param);
    }

    @Override
    public List<AppTeaFriend> list(Map<String, Object> paraMap, SplitPageBean splitPageBean) {
        List<AppTeaFriend> list = appTeaFriendDao.list(paraMap,splitPageBean);
        list.forEach(e->{
            AppUser appUser = appUserService.get(e.getUserId());
            e.setAge(appUser.getAge());
            e.setSex(appUser.getSex());
            e.setUserImg(appUser.getPic());
            e.setUserName(appUser.getNick());
        });

        return list;
    }
}
